package com.northpool.operator.common.algorithm;

import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;

public class CustomClassLoader extends URLClassLoader {

    public CustomClassLoader(URL[] urls) {
        super(urls);
    }

    public Class<?> findClass(File file, String name) throws ClassNotFoundException {
        byte[] classData = FileUtil.readBytes(file);
        return defineClass(name, classData, 0, classData.length);
    }
}
